<?php
namespace app\models\system;

use basic\BaseModel;
use traits\ModelTrait;

/**
 * 套餐列表
 * Class SystemPoint
 * @package app\models\system
 */
class SystemPoint extends BaseModel
{
    /**
     * 主键ID
     * @var string
     */
    protected $pk = "id";

    /**
     * 模型名称
     * @var string
     */
    protected $name = "system_point";

    use ModelTrait;

    /**
     * 获取器
     * @param $value
     * @return false|string
     */
    public function getAddTimeAttr($value)
    {
        return date("Y-m-d H:i:s", $value);
    }

    /**
     * 获取套餐列表
     * @return \think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public static function getSystemList()
    {
        return self::where("wxapp_id", self::$wxapp_id)
            ->field("id, title, num, give, price, add_time, sort")
            ->where('is_del', 0)
            ->where("is_show", 1)
            ->order("sort DESC")
            ->limit(6)
            ->select();
    }
}